package com.uniview.util;

import com.uniview.orm.model.SysUser;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author lux
 * @date: 2019/11/27
 * @desc: 用于存放全局变量
 */
public class ThreadUtils<T> {
    private static final ThreadLocal<String> tokenHolder = new ThreadLocal<>();

    private static final ThreadLocal<SysUser> userHolder = new ThreadLocal<SysUser>();

    public static void setToken(String token){
        tokenHolder.set(token);
    }

    public static String getToken(){
        return tokenHolder.get();
    }

    public static void setUserHolder(SysUser user){
        userHolder.set(user);
    }

    public static SysUser getUserHolder(){
        return userHolder.get();
    }

    public static void remove(){
        tokenHolder.remove();
        userHolder.remove();
    }

}
